# cuda flag
SET(CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELEASE}; ${CUDA_NVCC_FLAGS}; --use_fast_math; -DUSE_CUDA -gencode arch=compute_61,code=sm_61)

# find files
FILE(GLOB_RECURSE ALL_SRC_FILES *.cpp *.c *.cc)
FILE(GLOB_RECURSE CUDA_FILES *.cu)

# addlib and link
SET(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-10.0)
FIND_PACKAGE(CUDA REQUIRED)

CUDA_ADD_LIBRARY(${PROJECT_NAME} SHARED ${CUDA_FILES} ${ALL_SRC_FILES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS})

#install
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/../release/lib/)